package com.example.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;



import org.springframework.web.servlet.ModelAndView;

import com.example.pojo.Xs_dd;
import com.example.service.Xs_ddBiz;
import com.example.service.publi;

@RestController
@RequestMapping("xs_dd")
public class Xs_ddController {
      
	@Autowired
	private Xs_ddBiz xs_ddbiz;
	
	@Autowired
	private publi pub;
	
	//新增主详
	@RequestMapping("/xsddsava")
	@ResponseBody
	public  void xsddsava(@RequestBody Xs_dd xsdd){
		
		this.xs_ddbiz.savedd(xsdd);
		
	}
	
	//删除主详
	@ResponseBody
	@RequestMapping("/delxsddx") 
	public  void delxsddx(String xsdd){
		this.xs_ddbiz.delXs_ddx(xsdd);
        
	}
	
	//转销售报价单 queryxsbjinfo
	@RequestMapping("/zxsbjd") 
	public Object queryxsbjinfo(){
	
		 return this.xs_ddbiz.queryxsbjinfo();
	};
		
	//修改订单
	@RequestMapping("/upxsdds")
	public void upxsdds(Xs_dd billno){
		 System.out.println(billno+"单号");
         this.xs_ddbiz.upxsdd(billno);
	}
	
	//查询
	@ResponseBody 
	@RequestMapping("/selxsdd")
	public  Object selxsdd(String  pagesize){
	 
		return this.xs_ddbiz.selXs_dd(Integer.parseInt(pagesize));
	}
	
	
	//查询
		@RequestMapping("/ss")
		@ResponseBody
		public  String ss(){
			return "11111111111111111";
		}
		
	//单号   20170518020	
		@ResponseBody
		@RequestMapping("/danhao")
		public Object danhao(String dh){
              System.out.println(dh+"我是单号！！！！！");
			return this.pub.danhao(dh,"salesorder","Billno");
		}

		//查询历史记录
		@ResponseBody
		@RequestMapping("/queryxsdd")
		public List<Xs_dd> queryxsdd(){
		   
			return this.xs_ddbiz.queryxsdd();
			
		}
		//审核
		@ResponseBody
		@RequestMapping("/sh")
		public void shenhe(String billno){
		      
		      this.xs_ddbiz.shenhe(billno);
		}
		
		//反审核
		@ResponseBody
		@RequestMapping("/sh2")
		public void shenhe2(String billno){
		      
		      this.xs_ddbiz.shenhe2(billno);
		}
		
		
	@ResponseBody	
	@RequestMapping("/yemian")	
	public ModelAndView yemian(){
		
		return new ModelAndView("xiaoshoudingdan");
	}
	//修改单况
	@ResponseBody	
	@RequestMapping("/updatexs")	
	public void updatexsddx(String billno){
		  this.xs_ddbiz.updatexsddx(billno);
	};
    
	//修改单况
	@ResponseBody	
	@RequestMapping("/updatexsx")	
	public void updatexsx(String billno){
		  this.xs_ddbiz.updatexsx(billno);
	};
	
}
